package com.gameley.dmgtpf.common.core.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

// @Component// @Component 将当前类注入到Spring容器内
// @Aspect// @Aspect 表明是一个切面类
public class MyAspectLog
{
    // Pointcut 切入点
    // com.gameley.dmgtpf.*.controller
    /**
     * *********************************************************** <br>
     * *说明：定义切入点，切入点为com.example.aop下的所有函数 <br>
     * @see <br> <br>
     * @void <br>
     * @methods com.gameley.dmgtpf.common.base.aspect.DmgtpfLog#logAspect <br>
     * @author LiBencheng <br>
     * @date Created on 2021年7月27日 <br>
     * @time 下午5:14:19 <br>
     * @version 1.0 <br>
     ************************************************************* <br>
     */
    @Pointcut("execution(public * com.gameley.dmgtpf.*.controller.*.*(..))")
    public void logAspect()
    {
    }
    
    @Around("logAspect()")
    public Object deAround(ProceedingJoinPoint joinPoint) throws Throwable
    {
        System.out.println("1、deAround");
        return joinPoint.proceed();
    }

    @Before("logAspect()")
    public void doBefore(JoinPoint joinPoint)
    {
        System.out.println("2、doBefore");
    }
    
    @AfterReturning("logAspect()")
    public void doAfterReturning(JoinPoint joinPoint)
    {
        System.out.println("3、doAfterReturning");
    }

    @After("logAspect()")
    public void doAfter(JoinPoint joinPoint)
    {
        System.out.println("4、doAfter");
    }
    
    @AfterThrowing("logAspect()")
    public void deAfterThrowing(JoinPoint joinPoint)
    {
        System.out.println("2.5、deAfterThrowing");
    }
    
}
